import {
  wxRequest
} from '@/utils/wxRequest';

let env = "-test" //-dev 或者 -test
const apiMall = 'http://192.168.1.230:8080/yipeisongwx'
//  const apiMall = 'https://www.zcgeo.com/yipeisongwx'


//微信的jscode换取sessionKey
const wxJsCode2Session = (params) => wxRequest(params, apiMall + "/wx/mini/jscode2session");
const user2session = (params) => wxRequest(params, apiMall + "/api/wechat/user2session?jsoncallback=?");

//发送短信
const sendRandCode = (params) => wxRequest(params, apiMall + '/api/sms/send');
//用户手机绑定
const registerUser = (params) => wxRequest(params, apiMall + '/api/member/bindWx');

//快速下单
const quickOrder = (params) => wxRequest(params, apiMall + '/api/order/insert');
//根据openid获取会员信息
const getMemberByOpenid = (params) => wxRequest(params, apiMall + '/api/member/openid');
//查询药品列表
const getMedicineList = (params) => wxRequest(params, apiMall + '/api/medicine/list/openid');
const getHospitalList = (params) => wxRequest(params, apiMall + '/api/hospital/list');

//查询分组
const getGroupList = (params) => wxRequest(params, apiMall + '/api/supplier/list');
//获取历史订单列表
const getHistoryOrderList = (params) => wxRequest(params, apiMall + '/api/order/history/list');
//获取历史订单列表
const getOrderList = (params) => wxRequest(params, apiMall + '/api/order/list');
//查询我的订单
const getOrderDetails = (params) => wxRequest(params, apiMall + '/api/order/id');
//取消订单
const cancelOrder = (params) => wxRequest(params, apiMall + '/api/order/cancel/id');

//评论课程
const commentReserve =  (params) => wxRequest(params, apiMall + '/api/reserve/comment');
//用户是否绑定手机号
const getUserInfo = (params) => wxRequest(params, apiMall + '/api/member/mini');

//查看评价
const getHomework = (params) => wxRequest(params, apiMall + '/api/reserve/homework');

//获得当天抽奖次数
const getBounsCount = (params) => wxRequest(params, apiMall + '/api/bouns/count');

//抽奖
const getBouns = (params) => wxRequest(params, apiMall + '/api/bouns/lucky');

export default {
  wxJsCode2Session,
  getMemberByOpenid,
  user2session,
  getMedicineList,
  quickOrder,
  getGroupList,
  getHospitalList,
  sendRandCode,
  getOrderDetails,
  getHistoryOrderList,
  getOrderList,
  cancelOrder,
  registerUser,
  
  commentReserve,
  getUserInfo,
  getHomework,
  getBounsCount,
  getBouns
}
